using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using AFI.Speargun.Web.Models;
using AFI.Speargun.Web.Models.Validation;

namespace AFI.Speargun.Web.Controllers
{
    public partial class SystemController
    {
        //
        // GET: /System/IndexAcquisitionMode

        [Authorize]
        public ActionResult IndexAcquisitionMode()
        {
            return View(_service.ListAcquisitionModes());
        }

        //
        // GET: /System/CreateAcquisitionMode

        [Authorize]
        public ActionResult CreateAcquisitionMode()
        {
            return View();
        }

        //
        // POST: /System/CreateAcquisitionMode

        [AcceptVerbs(HttpVerbs.Post)]
        [Authorize]
        public ActionResult CreateAcquisitionMode(AcquisitionMode acquisitionMode)
        {
            if (_service.CreateAcquisitionMode(acquisitionMode))
                return RedirectToAction("IndexAcquisitionMode");
            return View();
        }

        //
        // GET: /System/EditAcquisitionMode/{id}

        [Authorize]
        public ActionResult EditAcquisitionMode(Guid id)
        {
            return View(_service.GetAcquisitionMode(id));
        }

        //
        // POST: /System/EditAcquisitionMode/{id}

        [AcceptVerbs(HttpVerbs.Post)]
        [Authorize]
        public ActionResult EditAcquisitionMode(Guid id, AcquisitionMode acquisitionMode)
        {
            acquisitionMode.AcquisitionModeId = id;

            if (_service.EditAcquisitionMode(acquisitionMode))
                return RedirectToAction("IndexAcquisitionMode");
            return View(acquisitionMode);
        }

        //
        // GET: /System/DeleteAcquisitionMode/{id}

        [Authorize]
        public ActionResult DeleteAcquisitionMode(Guid id)
        {
            return View(_service.GetAcquisitionMode(id));
        }

        //
        // POST: /System/DeleteAcquisitionMode/{id}

        [AcceptVerbs(HttpVerbs.Post)]
        [Authorize]
        public ActionResult DeleteAcquisitionMode(Guid id, AcquisitionMode acquisitionMode)
        {
            if (_service.DeleteAcquisitionMode(id))
                return RedirectToAction("IndexAcquisitionMode");
            return View(acquisitionMode);
        }
    }
}
